package ai.zixing.mashibing;

import java.util.Arrays;
import java.util.Random;

public class DataChecker {

    public static void main(String[] args) {
        System.out.println(check());
    }

    static int[] generateRandomArray() {
        Random r = new Random();
        int[] arr = new int[1000];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(1000);
        }
        return arr;
    }
    static boolean check() {
        int[] arr = generateRandomArray();
        int[] arr2 = new int[arr.length];
        System.arraycopy(arr, 0, arr2, 0, arr.length);
        Arrays.sort(arr);
        MergeSort.sort(arr2, 0, arr2.length - 1);
        for (int i = 0; i < arr2.length; i++) {
            if (arr[i] != arr2[i]) {
                return false;
            }
        }
        return true;
    }



}
